package school.emm;

import com.ericsson.mmaps.MapView;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Window;
import android.widget.TabHost;
import android.widget.TextView;

public class ChatRoomActivity extends TabActivity {
	TextView test, test2;
	TabHost tabHost_;
	TabHost.TabSpec spec_;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.chatroomlayout);

		tabHost_ = getTabHost();  
	}
	@Override
	public void onPause() {
		super.onPause();
	}
	@Override
	public void onResume() {
		super.onResume();
		// tabHost_ = restoreMe();
		createNewTab(getIntent().getStringExtra("topic").toString(), null);
	}
	public void createNewTab(String topic, String userlist) {
		Intent newtab = new Intent().setClass(this, ChatRoomTab.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec_ = tabHost_.newTabSpec(topic).setIndicator(topic).setContent(newtab);
		tabHost_.addTab(spec_);
	}
	@Override
	public Object onRetainNonConfigurationInstance() {
		return(tabHost_);
	}
	private TabHost restoreMe() {
		TabHost host = null;
		if (getLastNonConfigurationInstance()!=null) {			
			host = (TabHost)getLastNonConfigurationInstance();
		} 
		return host;
	}




}